package com.andy.qhb.controller.game;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.andy.qhb.base.RequestUtil;
import com.andy.qhb.controller.GameController;
import com.andy.qhb.game.GameUser;
import com.andy.qhb.utils.QRCodeUtil;

@Controller
@RequestMapping(value="game/api")
public class Api136Controller extends GameController{
	
	private Logger logger = LoggerFactory.getLogger(getClass());
	
	/**
	 * 二维码
	 * @param session
	 * @param data
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="136")
	public String action(HttpSession session,HttpServletResponse response,String data) throws Exception{
		GameUser user = getUser(session);
		
		String url = RequestUtil.getBasePath()+"?puid="+user.getId();
		
		// 微信模式
		url = Api100Controller.wx_url+"&state="+user.getId()+"#wechat_redirect";
		
		QRCodeUtil.encode(url, response.getOutputStream());
		return null;
		
	}
	
	
}